package com.hammera.common.baseUI

import android.os.Bundle
import com.zzh.base.BaseFragment
import com.zzh.base.BaseModel
import com.zzh.base.utils.TUtils

abstract class BaseMVPFragment<M : BaseModel<*>, V : BaseView, P : BasePresenter<M, V>> : BaseFragment(), BaseView {
    protected var mPresenter: P? = null
    protected var mModel: M? = null
    protected var mView: V? = null
    override fun onCreate(savedInstanceState: Bundle?) {
        mModel = TUtils.getT(this, 0)
        mView = this as V
        mPresenter = TUtils.getT(this, 2)
        mPresenter?.setMV(mModel, mView)
        mPresenter?.setContext(activity?.applicationContext)
        super.onCreate(savedInstanceState)
    }

    override fun onDestroyView() {
        super.onDestroyView()
        mPresenter?.onDestroy()
    }




}